package com.atguigu.gmall.product.service.impl;

import com.atguigu.gmall.model.product.BaseTrademark;
import com.atguigu.gmall.product.mapper.BaseTrademarkMapper;
import com.atguigu.gmall.product.service.BaseTrademarkService;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * @author mqx
 * 由于BaseTrademarkService 接口继承了IService 接口，所以它有了新的抽象方法，
 * 这些新的抽象方法，继承 ServiceImpl 来实现
 * @date 2020-7-25 14:13:12
 */
@Service
public class BaseTrademarkServiceImpl extends ServiceImpl<BaseTrademarkMapper,BaseTrademark> implements BaseTrademarkService {

    @Autowired
    private BaseTrademarkMapper baseTrademarkMapper;

    @Override
    public IPage<BaseTrademark> getBaseTrademarkList(Page<BaseTrademark> param) {
        // 设置一个查询之后，排序规则
        // select * from base_trademark order by id
        QueryWrapper<BaseTrademark> baseTrademarkQueryWrapper = new QueryWrapper<>();
        baseTrademarkQueryWrapper.orderByDesc("id");
//        baseTrademarkQueryWrapper.orderByAsc("id");
        return baseTrademarkMapper.selectPage(param,baseTrademarkQueryWrapper);
    }

//    @Override
//    public List<BaseTrademark> getTrademarkList() {
//        return baseTrademarkMapper.selectList(null);
//    }
}
